//
//  HeTongManagerVC.m
//  LogisticsSupplier
//
//  Created by 吕晶 on 2020/8/5.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "HeTongManagerVC.h"
#import "HeTongListVC.h"

@interface HeTongManagerVC ()<ZJScrollPageViewDelegate>

@property (nonatomic, strong) ZJSegmentStyle *menuStyle;//菜单栏
@property (nonatomic, strong) NSArray<NSString *> *titles;
@property (nonatomic, strong) ZJScrollPageView *scrollPageView;
@property (nonatomic, strong) UIView *scrollPageBGView;

@end

@implementation HeTongManagerVC

-(ZJScrollPageView *)scrollPageView {
    if (!_scrollPageView) {
        _scrollPageView = [[ZJScrollPageView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH - BottomHeight - NaviHeight) segmentStyle:self.menuStyle titles:self.titles parentViewController:self delegate:self];
    }
    return _scrollPageView;
}

-(UIView *)scrollPageBGView {
    if (!_scrollPageBGView) {
        _scrollPageBGView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, 40)];
        _scrollPageBGView.backgroundColor = [UIColor whiteColor];
    }
    return _scrollPageBGView;
}

-(ZJSegmentStyle *)menuStyle {
    if (!_menuStyle) {
        _menuStyle = [ZJSegmentStyle new];
        _menuStyle.autoAdjustTitlesWidth = YES;
        _menuStyle.showLine = YES;//显示下划线
        _menuStyle.scrollTitle = YES;//设置标题栏可以滚动
        _menuStyle.segmentViewBounces = YES;//设置滚动标题栏有弹性
        _menuStyle.scaleTitle = YES;//设置选中标题缩放
        _menuStyle.scrollContentView = YES;//内容可以滑动
        _menuStyle.normalTitleColor = HexColor(0x9C9DB3);
        _menuStyle.selectedTitleColor = Color_ThemeColor;
        _menuStyle.scrollLineColor = Color_ThemeColor;
        _menuStyle.scrollLineWidth = 12;
        _menuStyle.segmentHeight = 40;
        _menuStyle.titleBigScale = 1.1;
        _menuStyle.titleFont = [UIFont systemFontOfSize:14];
    }
    return _menuStyle;
}

-(NSArray<NSString *> *)titles {
    if (!_titles) {
        _titles = @[@"全部",@"待确认",@"进行中",@"驳回"];
    }
    return _titles;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"合同管理";
    [self.view addSubview:self.scrollPageBGView];
    [self.view addSubview:self.scrollPageView];
}

- (NSInteger)numberOfChildViewControllers {
    return self.titles.count;
}

- (UIViewController<ZJScrollPageViewChildVcDelegate> *)childViewController:(UIViewController<ZJScrollPageViewChildVcDelegate> *)reuseViewController forIndex:(NSInteger)index {
    HeTongListVC<ZJScrollPageViewChildVcDelegate> * childVC = (HeTongListVC *)reuseViewController;
    HeTongListVC *vc = [HeTongListVC new];
    if (index == 0) {
        vc.status = 0;
    }else if (index == 1) {
        vc.status = 2;
    }else if (index == 2) {
        vc.status = 3;
    }else if (index == 3) {
        vc.status = 4;
    }
    childVC = vc;
    return childVC;
}

//子控制器实现完整生命周期
- (BOOL)shouldAutomaticallyForwardAppearanceMethods {
    return NO;
}

@end
